import java.util.List;

public class Test {
    public int size() {
        ListNode cur = head;
        int i = 0;
        while(cur.next! = null) {
            cur = cur.next;
            i++;
        }
        return i+1;
    }

    public boolean contains(int key) {
        ListNode cur = head;
        while(cur.next! = null) {
            if(cur.val==key) {
                return true;
            }else {
                cur = cur.next;
        }
        return false;
    }

        public void endadd(int data) {
            ListNode cur = head;
            ListNode newnode = new ListnNode();

            if(cur == null) {
                cur.newnode = node;
                return;
            }
            while(cur!=null) {
                cur = cur.next;
            }
            cur.newnode = node;
        }
}
